﻿ 
 
using System;
using System.Collections.Generic;
namespace Base.Common {
    public class LoggerCommon {
  
    
     
        
        
        static void addMongon(String s) {
            if(String.IsNullOrEmpty(s)) {
                return;
            }
            if (!BaseConfig.loggerMongon ) {
                return;
            }
          
        }
        //file all   
        public static void fileAll(string s) {
            if(String.IsNullOrEmpty(s)) {
                return;
            }
            MyConsole.addMessage(s);
            addMongon(s);
           
            if ( BaseConfig.loggerInfoLoggerFile ) {
                  FileLogger.Info(s);
            }
            LoggerCache.has(s);
        }
        public static void error(string s,Exception ex) {
            if(String.IsNullOrEmpty(s)) {
                return;
            }
            MyConsole.addMessage(s);
            addMongon(s+ex.Message+ex.StackTrace);;
            FileLogger.Error(s,ex);
            LoggerCache.has(s);
        }
        public static void consol(String format ,params object[] p) {
            if( p.Length > 0 ) {
                format = String.Format(format ,p);
            }
            consol(format);
        }
        public static void consol(string s) {
            if(String.IsNullOrEmpty(s)) {
                return;
            }
            MyConsole.addMessage(s);
            if(LoggerCache.has(s)) {
                return;
            }
         /*
            if ( BaseConfig.loggerInfoLoggerFile ) {
                FileLogger.Info(s);
            }*/
            addMongon(s);
        }
         public static void consoleOnly(string s) {
            if( String.IsNullOrEmpty(s) ) {
                return;
            }
            MyConsole.addMessage(s);
            if( LoggerCache.has(s) ) {
                return;
            }
          }

        public static void consoleOnly(String format ,params object[] p) {
            if( p.Length > 0 ) {
                format = String.Format(format ,p);
            }
           consoleOnly(  format);
        }
    }
}
